package com.itbaizhan.cglib;

import net.sf.cglib.proxy.Enhancer;

public class Test {

    public static void main(String[] args) {
        //被代理对象
        Apple apple = new Apple();
        //代理方式
        ShoppingProxy shoppingProxy = new ShoppingProxy(apple);
        //生成代理对象  Enhancer.create()
        Apple appleTao= (Apple)Enhancer.create(Apple.class,shoppingProxy);
        //执行增强方法
        String sell = appleTao.sell(8000);
        System.out.println(sell);
        appleTao.repair();
    }
}
